<%@ page language="java" import="java.util.*" pageEncoding="utf-8"%>
<%@ taglib uri="/struts-tags" prefix="s" %>
<%
String path = request.getContextPath();
String basePath = request.getScheme()+"://"+request.getServerName()+":"+request.getServerPort()+path+"/";
%>

<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN">
<html>
<head>
	<base href="<%=basePath%>">
	<title>hr-m-s</title>
	<meta http-equiv="pragma" content="no-cache">
	<meta http-equiv="cache-control" content="no-cache">
	<meta http-equiv="expires" content="0">    
	<meta http-equiv="keywords" content="keyword1,keyword2,keyword3">
	<meta http-equiv="description" content="This is my page">
	<link rel="stylesheet" type="text/css" href="css/style.css" >
</head>
<body>
<table width="900" border="1" align="center" cellpadding="0" cellspacing="0">
  <tr>
    <th colspan="7">员工信息列表</th>
  </tr>
  <tr>
    <td colspan="6">
		<form id="search_form" name="search_form" method="post" action="staff!search" onsubmit="javascript:return checkSearchForm();">
		  搜索组别
		  <select name="searchType" id="searchType">
		    <option value="0">请选择</option>
		    <s:if test="searchType == 1">
			    <option value="1" selected="selected">姓名</option>
			    <option value="2">部门</option>
		    </s:if>
		    <s:elseif test="searchType == 2">
		    	<option value="1">姓名</option>
			    <option value="2" selected="selected">部门</option>
		    </s:elseif>
		    <s:else>
		    	<option value="1">姓名</option>
			    <option value="2">部门</option>
		    </s:else>
	      </select>
    	  关键字
    	<input name="searchKeyword" type="text" id="searchKeyword" size="30" maxlength="1024" value='<s:property value="searchKeyword"/>'/>
		<input name="search" type="submit" id="search" value="搜索"/>
		<input name="nowPage" id="nowPage" type="hidden" value="1"/>
		</form>
	</td>
    <td><a href="staff!initFormData">新增</a></td>
  </tr>
  <tr>
    <td width="100" height="20">编号</td>
    <td width="100">姓名</td>
    <td width="200">部门</td>
    <td width="200">职位</td>
    <td width="200">入职时间</td>
    <td width="50">编辑</td>
    <td width="50">离职</td>
  </tr>
  <s:iterator value="staffVOList" var="list">
	  <tr>
	    <td width="100"><s:property value="staffID"/></td>
	    <td width="100"><s:property value="staffName"/></td>
	    <td width="200"><s:property value="department.departmentName"/></td>
	    <td width="200"><s:property value="position.positionName"/></td>
	    <td width="200"><s:date format="yyyy-MM-dd HH:mm:ss" name="staffCreateDate"/></td>
	    <td width="50"><a href='staff!update?mode=getStaffPO&staffID=<s:property value="staffID"/>'>编辑</a></td>
	    <td width="50"><a href='staff!confirm?staffID=<s:property value="staffID"/>'>离职</a></td>
	  </tr>
  </s:iterator>
  <tr>
    <td height="22" colspan="7">
      	第<s:property value="nowPage"/>/<s:property value="pageCount"/>页&nbsp;&nbsp;
      	<s:if test="nowPage == 1">
      		<a>首页</a>&nbsp;&nbsp;
      	</s:if>
      	<s:else>
      		<a href="javascript:void(0);" onclick="javascript:postForm(1);">首页</a>&nbsp;&nbsp;
      	</s:else>
      	<s:if test="nowPage == 1">
      		<a>上一页 </a>&nbsp;&nbsp;
      	</s:if>
      	<s:else>
      		<a href="javascript:void(0);" onclick='javascript:postForm(<s:property value="nowPage-1"/>);'>上一页</a>&nbsp;&nbsp;
      	</s:else>
      	<s:if test="nowPage == pageCount">
      		<a>下一页 </a>&nbsp;&nbsp;
      	</s:if>
      	<s:else>
      		<a href="javascript:void(0);" onclick='javascript:postForm(<s:property value="nowPage+1"/>);'>下一页</a>&nbsp;&nbsp;
      	</s:else>
      	<s:if test="nowPage == pageCount">
      		<a>尾页 </a>&nbsp;&nbsp;
      	</s:if>
      	<s:else>
      		<a href="javascript:void(0);" onclick='javascript:postForm(<s:property value="pageCount"/>);'>尾页</a>&nbsp;&nbsp;
      	</s:else>
      	
	</td>
  </tr>
</table>
<div>&nbsp;</div>
<div>&nbsp;</div>
<div id="showMessage" align="center"><s:property value="messageTips" /></div>
<script type="text/javascript">
function checkSearchForm(){
	if ($("searchType").selectedIndex == 0){
		alert("请选择搜索组别！");
		$("searchType").focus();
		return false;
	}
	return true;
}
function $(value){
	return document.getElementById(value);
}
function postForm(pageID){
	$("nowPage").value = pageID;
	var myForm = $("search_form");
	myForm.submit();
}
</script>
</body>
</html>
